﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using System.ServiceModel;
using System.ServiceModel.Channels;

using Coowork.WcfCommon;

namespace Coowork.WcfClient
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            AppClient.Credentials.UserName = "Allex";
            AppClient.Credentials.Password = "Password";

          
        }



        static string text = @"
Windows – The Universal Code Breaker
by Alexandru Lungu 17. February 2011 23:47
 
Because both the system's privacy and the security of digital money depend on encryption, a breakthrough in mathematics or computer science that defeats the cryptographic system could be a disaster. The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers# (Bill Gates, The Road Ahead, 1995)
Actually, there is no need for breakthroughs; Bill Gates/Microsoft can “defeat the cryptographic system” by themselves with the simple formula:

... to be continued on www.challenge-me.ws
";

        private void button1_Click(object sender, EventArgs e)
        {

            using (ChannelFactory<IExampleService> exampleChannel = new ChannelFactory<IExampleService>("ExampleService"))
            {
                IExampleService exampleProxy = exampleChannel.CreateChannel();

                int sum = exampleProxy.Sum(100, 25);
                textBox1.Text = "sum = " + sum;

                //string txt = exampleProxy.MultiplyText(text, 3);
                //Console.WriteLine("Text = ");
                //Console.WriteLine(txt);
                //Console.WriteLine(Environment.NewLine + "Operations completed successfully!");
                //Console.ReadKey();
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {

            using (ChannelFactory<IExampleService> exampleChannel = new ChannelFactory<IExampleService>("ExampleService"))
            {
                IExampleService exampleProxy = exampleChannel.CreateChannel();

                //int sum = exampleProxy.Sum(100, 25);
                //textBox1.Text = "sum = " + sum;

                string txt = exampleProxy.MultiplyText(text, 3);
                textBox2.Text = "Text = " + txt + Environment.NewLine + "Operations completed successfully!";

            }

        }

    }
}
